<?php
if(!defined('IN_IBEIKE')) {
	exit('Access Denied');
}
class table_city_thread extends common_table{
	public function __construct(){
		$this->_table='city_thread';
		$this->_pk='tid';
		parent::__construct();
	}
	public function insert($data,$return_insert_id=false){
		if($data && is_array($data)){
			return DB::insert($this->_table, $data, $return_insert_id);
		}
		return 0;
	}
	public function del_thread($data){
		if($data){
			return DB::delete($this->_table, $data);
		}
		return 0;
	}
	public function fetch_by_fid_banned($fid, $banned= 0, $order = 'views', $sort = 'DESC'){
		$fid=intval($fid);
		if(!empty($fid)){
			$ordersql = !empty($order) ? ' ORDER BY '.DB::order($order, $sort) : '';
			return DB::fetch_all("SELECT * FROM %t WHERE fid=%d AND banned=%d $ordersql",array($this->_table,$fid,$banned));	
		}
	}
	public function fetch_all_by_tid($tid){
		if(!empty($tid)&&$tid){
			return DB::fetch_all('SELECT * FROM %t WHERE tid=%s',array($this->_table,$tid));//返回数组包含各个字段的值
		}
		return false;
	}
	

}
?>